import { vanillaExtractPlugin as vanillaExtract } from "@vanilla-extract/vite-plugin"
import { join } from "node:path"
import { defineConfig } from "vite"
import solid from "vite-plugin-solid"
import tsconfigPaths from "vite-tsconfig-paths"

const root = import.meta.dirname

export default defineConfig({
  plugins: [
    vanillaExtract({ identifiers: ({ hash }) => `c${hash.slice(0, 15)}` }),
    tsconfigPaths(),
    solid(),
  ],
  base: "./",
  build: {
    outDir: join(root, "out"),
    rollupOptions: {
      output: {
        assetFileNames: "[hash].[ext]",
        chunkFileNames: "[hash].js",
        entryFileNames: "[hash].js",
      },
    },
  },
})
